package com.ruoyi.tracker.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.tracker.domain.VehiclePosition;
import com.ruoyi.tracker.service.IVehiclePositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: 凯不忒埔
 * @ProjectName RuoYi-month
 * @ClassName TrackerController
 * @Date: 2025/9/6 08:55
 * @Description:
 */
@RestController
@RequestMapping("/tracker")
public class TrackerController {
    @Autowired
    private IVehiclePositionService vehiclePositionService;

    /**
     * 上报车辆位置
     */
    @PostMapping("/report")
    public AjaxResult reportVehiclePosition(@RequestBody VehiclePosition vehiclePosition) {
        boolean result = vehiclePositionService.reportVehiclePosition(vehiclePosition);
        return result ? AjaxResult.success("位置上报成功") : AjaxResult.error("位置上报失败");
    }
}